import java.util.Scanner;

public class Exam1 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请赋予a一个值");
        int x = scan.nextInt();
        System.out.println("有几个数相加？");
        int y = scan.nextInt();

        int sum = calculation(x,y);
        System.out.println("结果= "+ sum);

    }

    public static int calculation(int a, int b) {
        int sum = 0;
        int num = a;
        /*for (int i = 1; i <= b; i++) {
            sum = sum + num;
            num = num*10 + a;
        }*/
        for (int i = 1; i <= b; i++) {
            num = num*10 + a;
            sum = sum + num;

        }
        return sum;
    }
}
